package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.*;
import com.itlong.cloud.POJO.VO.operate.OperateDeveloperAuthDeviceAuthVO;
import com.itlong.cloud.POJO.VO.operate.OperateDeveloperAuthVO;
import com.itlong.cloud.POJO.VO.operate.OperateRobotDeveloperDeviceAuthVO;
import com.itlong.cloud.operate.service.IOperateDeveloperAuthService;
import com.itlong.cloud.user.operate.IOperateDeveloperAuthServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      运营-开发者授权管理暴露接口实现类
 * </desc>
 *
 * @createDate 2018/12/18
 */
@RestController
public class OperateDeveloperAuthServiceResource implements IOperateDeveloperAuthServiceClient {

    @Autowired
    private IOperateDeveloperAuthService iOperateDeveloperAuthService;

    /**
     * <desc>
     *      获取开发者授权信息分页列表
     * </desc>
     *
     * @param dto 查询参数DTO
     * @return
     * @author Qiang.S
     * @createDate 2018/12/19
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/getDeveloperAuthByPage")
    public Page<OperateDeveloperAuthVO> getDeveloperAuthByPage(@RequestBody OperateLoggerDeveloperAuthGetPageDTO dto) throws Exception {
        return iOperateDeveloperAuthService.getDeveloperAuthByPage(dto);
    }

    /**
     * <desc>
     *      安全设置
     * </desc>
     *
     * @param operateDeveloperAuthSafeSettingsDTO 安全设置DTO
     * @return 受影响的行数
     * @author wangzhi
     * @createDate 2018/12/18
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/safeSettings")
    public Integer safeSettings(@RequestBody OperateDeveloperAuthSafeSettingsDTO operateDeveloperAuthSafeSettingsDTO) throws Exception {
        return iOperateDeveloperAuthService.safeSettings(operateDeveloperAuthSafeSettingsDTO);
    }

    /**
     * <desc>
     *      有效期延期设置
     * </desc>
     *
     * @param operateDeveloperAuthMoreValidityDTO 有效期延期设置DTO
     * @return 受影响行数
     * @author wangzhi
     * @createDate 2018/12/18
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/moreValidity")
    public Integer moreValidity(@RequestBody OperateDeveloperAuthMoreValidityDTO operateDeveloperAuthMoreValidityDTO) throws Exception {
        return iOperateDeveloperAuthService.moreValidity(operateDeveloperAuthMoreValidityDTO);
    }

    /**
     * <desc>
     *      获取设备授权列表
     * </desc>
     *
     * @param operateDeveloperAuthDeviceAuthListDTO 设备授权列表DTO
     * @return 设备授权列表VO
     * @author wangzhi
     * @createDate 2018/12/18
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/deviceAuthList")
    public OperateDeveloperAuthDeviceAuthVO deviceAuthList(@RequestBody OperateDeveloperAuthDeviceAuthListDTO operateDeveloperAuthDeviceAuthListDTO) throws Exception {
        return iOperateDeveloperAuthService.deviceAuthList(operateDeveloperAuthDeviceAuthListDTO);
    }

    /**
     * <desc>
     *      机器人开发者获取设备授权列表
     * </desc>
     *
     * @param operateDeveloperAuthDeviceAuthListDTO 设备授权列表DTO
     * @return 设备授权列表VO
     * @author Qiang.S
     * @createDate 2020/03/20
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/robotDeviceAuthList")
    public OperateRobotDeveloperDeviceAuthVO robotDeviceAuthList(@RequestBody OperateDeveloperAuthDeviceAuthListDTO operateDeveloperAuthDeviceAuthListDTO) throws Exception {
        return iOperateDeveloperAuthService.robotDeviceAuthList(operateDeveloperAuthDeviceAuthListDTO);
    }

    /**
     * <desc>
     *      设备授权
     * </desc>
     *
     * @param operateDeveloperAuthDeviceAuthDTO 设备授权DTO
     * @return 受影响行数
     * @author wangzhi
     * @createDate 2018/12/18
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/deviceAuth")
    public Integer deviceAuth(@RequestBody OperateDeveloperAuthDeviceAuthDTO operateDeveloperAuthDeviceAuthDTO) throws Exception {
        return iOperateDeveloperAuthService.deviceAuth(operateDeveloperAuthDeviceAuthDTO);
    }

    /**
     * <desc>
     *      接口授权
     * </desc>
     *
     * @param operateDeveloperRobotAuthDeviceAuthDTO 设备授权DTO
     * @return 受影响行数
     * @author Qiang.S
     * @createDate 2020/03/20
     */
    @Override
    @PostMapping(path = "/operate/developerAuthManage/robotDeviceAuth")
    public Integer robotDeviceAuth(@RequestBody OperateDeveloperRobotAuthDeviceAuthDTO operateDeveloperRobotAuthDeviceAuthDTO) throws Exception {
        return iOperateDeveloperAuthService.robotDeviceAuth(operateDeveloperRobotAuthDeviceAuthDTO);
    }
}
